#include<iomanip>
#include<iostream>
using namespace std;

int main(void)
{
	const int n = 4;
	float a[n][n] = {
		{2, 3, 1, 5},
		{6, 13, 5, 19},
		{2, 19, 10, 23},
		{4, 10, 11, 31}
	};
	
	for (int i = 0; i < n; i++)
	{
		for (int j = i + 1; j < n; j++)
		{
			a[j][i] /= a[i][i];
		}
		
		for (int j = i + 1; j < n; j++)
		{
			for (int k = i + 1; k < n; k++)
			{
				a[j][k] -= a[j][i] * a[i][k];
			}
		}
	}
	
	cout<< "L =\n";
	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j < n; j++)
		{
			if (i == j)
			{
				cout<< setw(5) << 1;
			}
			else if (i < j)
			{
				cout<< setw(5) << 0;
			}
			else
			{
				cout<< setw(5) << setiosflags(ios::fixed) << setprecision(2) << a[i][j];
			}
		}
		cout<< endl;
	}
	
	cout<< "U =\n";
	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j < n; j++)
		{
			if (i > j)
			{
				cout<< setw(5) << 0;
			}
			else
			{
				cout<< setw(5) << setiosflags(ios::fixed) << setprecision(2) << a[i][j];
			}
		}
		cout<< endl;
	}
}
